package cn.com.roy.thread.t3_1_3.test3;

public class ThreadA extends Thread {
    private Object lock;

    public ThreadA(Object lock) {
        this.lock = lock;
    }

    @Override
    public void run() {
        super.run();
        try {
            synchronized (lock) {
                if(TransService.size() != 5){
                    System.out.println("wait begine: " +System.currentTimeMillis());
                    lock.wait();
                    System.out.println("wait end:" + System.currentTimeMillis());
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
